package cn.dnui_lf_705.dnui_16110100705.model;

import java.util.List;


import cn.dnui_lf_705.dnui_16110100705.bean.ResultBean;
import cn.dnui_lf_705.dnui_16110100705.bean.ShopBean;
import cn.dnui_lf_705.dnui_16110100705.bean.UserBean;
import cn.dnui_lf_705.dnui_16110100705.iface.ShopIface;
import cn.dnui_lf_705.dnui_16110100705.listener.OnRetrofitListener;
import cn.dnui_lf_705.dnui_16110100705.service.ShopServer;
import retrofit2.Call;

public class ShopModel extends BaseModel implements ShopIface {
    private ShopServer shopServer;
    public ShopModel(){
        this.shopServer = retrofit.create(ShopServer.class);
    }
    public void getAllShops(OnRetrofitListener listener){
        Call<List<ShopBean>> call = shopServer.getAllShops();
        bindCallback(call,listener,1);  //这个flag有啥用     区分请求1收藏 2取消收藏
    }



    public void getShopById(String shop_id, OnRetrofitListener listener) {
        Call<ShopBean> call = shopServer.getShopById(shop_id);
        bindCallback(call,listener,2);
    }

    public void getUserById(String user_id,OnRetrofitListener listener)
    {
        Call<UserBean> call = shopServer.getUserById(user_id);
        bindCallback(call,listener,3);
    }

    public void insertOrder(String user_id,String food_id,String num,String sum,String suggesttime,String address,OnRetrofitListener listener)
    {
        Call<ResultBean> call = shopServer.insertOrder(user_id,food_id,num,sum,suggesttime,address);
        bindCallback(call,listener,4);
    }

}
